A USB Class Driver sample demonstrating the implementation of a USB Class Driver for a Comm Class Device
Description
The USBModem sample demonstrates the use of the Mac OS USB to create a class driver for a comm class device. This sample includes the implementation of a compatability shim.
The sample requires the use of the SerialShimLib CFM Library file, which is included. The SerialShimLib must be placed in the Extensions folder.
Important Note: This library is installed by the Mac OS 8.6 Installer only on Power Macintosh Systems with USB Built-in. The SerialShimLib file is available for licensing for use on other Power Macintosh systems by contacting Apple Software Licensing at sw.license@apple.com. If your software package installs this extension, it is important to check for a newer version of the SerialShimLib already present on the target system and to not overwrite the newer document.
Building the Code
This sample was built using the Metrowerks CodeWarrior Pro 2, IDE v2.1 environment and the Mac OS USB DDK v1.0.1. Also required, is the Universal Interfaces and Libraries 3.1.
To rebuild the project, first place the USBModem folder into the USBDDK:Examples: folder. The project file assumes specific access paths that are project specific. The resulting class driver, USBModem, is built into the USBDDK:Extensions-MCWBuilt: folder.
You can also build this sample using MPW which has already been configured for the USB DDK. The USBModem sample will appear as another sample in the USBDDK menu.
Notes
The compatibility shim code must export the SerHAL_Entry procedure, which is picked up by the SerialShimLib. The SerialShimLib will register a unit table driver when the ShimInstall call is made. Note that the ShimInstall call requires the CFragConnectionID parameter. This is required for the SerialShimLib code to make the FindSymbol call to obtain the SerHAL_Entry proc entry.
Other entry points to the SerialShimLib are the
1. RemoveShimDrvr and
2. ShimIOComplete calls.
OSErr RemoveShimDrvr(Boolean forceFlag) - closes the shim unit table driver. Before this call is made, ensure that the compatibility shim has killed all outstanding parameter block calls.
void ShimIOComplete(ParmBlkPtr pb, OSErr result) - used to complete the parameter block call that was passed to the SerialHAL_Entry call for processing. Set the ParmBlkPtr as the address of the parameter block whose processing is complete. Pass the result of the call as the result parameter.
Bug Reports:
If you find any bugs, please send them to "usb@isg.apple.com" and include "Attn: Rich Kubota" and I will try to address them.
Questions??:
For any questions which you may have with this sample or with Mac OS USB, please submit them to either the Mac OS USB mailing list, usb@apple.com, or to Worldwide Macintosh Developer Technical Support (WWDTS), dts@apple.com. If you are not familiar with the recent changes to the WWDTS support plans, please check them out at the Developer Programs web page,
<http://developer.apple.com/programs/>
To subscribe to the Mac OS USB Developer mailing list, send an email to usb@isg.apple.com with the email subject set to "subscribe".